/*
 * ProgrammingError.java - ScriptME
 * 
 * Copyright (c) 2009 Cesar Henriques <cesar at alttab.com.ar>.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser Public License v2.1
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * 
 * Based on FESI Project
 * 
 * Contributors:
 * 	Jean-Marc Lugrin - initial API and implementation
 * 	Cesar Henriques <cesar at alttab.com.ar> - J2ME Porting and Extensions
 */
package org.scriptme.ecmascript.exceptions;

/**
 * Exception used to signal internal programming error (assert error).
 */
public class ProgrammingError extends Error {

	/** The end of line string for this machine. */
	static protected String eol = System.getProperty("line.separator") == null ? "\n"
			: System.getProperty("line.separator");

	/**
	 * Create an anonymous programming error exception.
	 */
	public ProgrammingError() {
	}

	/**
	 * Create a programming error exception with explanatory test.
	 * 
	 * @param message
	 *            Reason of the error
	 */
	public ProgrammingError(String message) {
		super(message);
	}

	/**
	 * Display the internal error asking to contact the author.
	 * 
	 * @return the message
	 */
	public String getMessage() {
		String m = super.getMessage();
		m += eol
				+ "*** EcmaScript Interpreter Internal error - contact the author ***";
		return m;
	}
}
